home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- /*
- * light.c
- */
-
- #include "gl.h"
- #include "light.h"
-
- static int curmaterial = 0;
-
- /*
- * materials
- */
- float mat_logo[] = {AMBIENT, 0.0, 0.0, 0.0,
- DIFFUSE, 0.8, 0.4, 1.0,
- SPECULAR, 1.0, 1.0, 1.0,
- SHININESS, 20.0,
- LMNULL};
-
-
- /*
- * lights
- */
- float light1[] = {AMBIENT, 0.0, 0.0, 0.0,
- LCOLOR, 1.0, 1.0, 1.0,
- POSITION, 1.0, 0.0, 0.0, 0.0,
- LMNULL};
-
- float light2[] = {AMBIENT, 0.0, 0.0, 0.0,
- LCOLOR, 0.5, 0.1, 0.0,
- POSITION, 0.0, -1.0, 0.0, 0.0,
- LMNULL};
-
- /*
- * lighting models
- */
- float infinite[] = {AMBIENT, 0.3, 0.3, 0.3,
- LOCALVIEWER, 0.0,
- LMNULL};
-
-
- init_lighting()
- {
- lmdef (DEFMATERIAL, MAT_LOGO, 0, mat_logo);
-
- lmdef (DEFLIGHT, OVER_LIGHT, 0, light1);
- lmdef (DEFLIGHT, UNDER_LIGHT, 0, light2);
-
- lmdef (DEFLMODEL, INFINITE, 0, infinite);
-
- lmbind(LIGHT0, OVER_LIGHT);
- lmbind(LIGHT1, UNDER_LIGHT);
-
- /*
- * load the lighting model and then turn off lighting
- */
- lmbind(LMODEL, INFINITE);
- lmbind(LMODEL, 0);
- }
-
-
- lighting(b)
- int b;
- {
- if (b)
- lmbind(LMODEL, INFINITE);
- else
- lmbind(LMODEL, 0);
- }
-
-
- setmaterial(name)
- {
- if (name != curmaterial)
- {
- curmaterial = name;
- lmbind(MATERIAL, name);
- }
- }
-